package com.copa.l1588;

/**
 * @author copa
 * @createDate 2022-08-30 15:24
 * @function 暴力法
 */
public class Test1 {

    public int sumOddLengthSubarrays(int[] arr) {
        int sum = 0;
        for (int i = 1; i <= arr.length; i+=2) {
            for (int j = 0; j < arr.length - i + 1; j++) {
                for (int k = j; k < j + i; k++) {
                    sum += arr[k];
                }
            }

        }
        return sum;
    }

    public static void main(String[] args) {
        int[] arr = {1,4,2,5,3};
        System.out.println(new Test1().sumOddLengthSubarrays(arr));
    }
}
